type IsAny<T> = T extends ('abin' & T) ? true : false
type Test1 = IsAny<'q'>

type IsEqual2<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false
type Test2 = IsEqual2<'a', any>

type IsUnion<A, B = A> = A extends A ? [B] extends [A] ? false : true : never
type Test3 = IsUnion<'a', 'b'> 

type NotEqual<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? false : true
type IsTuple<T> = T extends [...params: infer Eles] ? NotEqual<Eles['length'], number> : false
type Test4 = IsTuple<['a', 1, [12]]>

type UnionToIntersection<U> = (U extends U ? (x : U) => unknown : never) extends (x: infer R) => unknown ? R : never
type Test5 = UnionToIntersection<{abin: 1} | {good: 2}>

type GetOptional<Obj extends Record<string, any>> = {
    [Key in keyof Obj as {} extends Pick<Obj, Key> ? Key : never] : Obj[Key] 
}

interface obj {
    a: string,
    b: number,
    c?:boolean
}
type Test6 = GetOptional<obj>

type GetRequired<Obj extends Record<string, any>> = {
    [Key in keyof Obj as {} extends Pick<Obj, Key> ? never : Key] : Obj[Key]
}
type Test7 = GetRequired<obj>

type RemoveIndexSignature<Obj extends Record<string, any>> = {
    [Key in keyof Obj as Key extends `${infer Str}` ? Key : never] : Obj[Key]
}

interface obj2 {
    a: string
    b: number
    [key: string] : any
}

type Test8 = RemoveIndexSignature<obj2>

class Abin {
    public name: string
    private age: number
    
    constructor() {
        this.name = 'abin'
        this.age = 20
    }
}

type ClassPublicProps<Obj extends Record<string, any>> = {
    [Key in keyof Obj] : Obj[Key]
}
type Test9 = ClassPublicProps<Abin>

type ReverseArr<Arr> = Arr extends readonly[infer A, infer B, infer C] ? [C, B, A] : never
let arr = ['a', 1, [12]] as const;
type arrType = typeof arr
type Test10 = ReverseArr<arrType>

type ParseParam<Param extends string> = Param extends `${infer Key}=${infer Value}` ? {
    [ke in Key] : Value
} : {}
type MergeParam<OneParam extends Record<string, any>, OtherParam extends Record<string, any>> = {
    [Key in keyof OneParam | keyof OtherParam]: Key extends keyof OneParam ? 
        Key extends keyof OtherParam ? MergeValue<OneParam[Key], OtherParam[Key]> : OneParam[Key] :
        Key extends keyof OtherParam ? OtherParam[Key] : never
}

type MergeValue<One, Other> = One extends Other ? One : Other extends unknown[] ? [One, ...Other] : [One, Other]
type ParseQueryString<Str extends string> = Str extends `${infer Param}&${infer Rest}` ? MergeParam<ParseParam<Param>, ParseQueryString<Rest>> : ParseParam<Str>
type Test11 = ParseQueryString<'a=1&b=2&c=3'>